#pragma once
#include "albumstab.h"
#include "httpget.h"
#include "afxtempl.h"
#include "xmlextractor.h"
#include "traynot.h"
#include "resizablesheet.h"

// CAllTabs

#define TAB_ALBUMS 0
#define TAB_COVER 1
#define TAB_REVIEWS 2
#define TAB_ID3 3

#define BAD_PIC_SIZE 1000

class CAllTabs : public CResizableSheet
{
	DECLARE_DYNAMIC(CAllTabs)

public:
	CAllTabs(UINT nIDCaption, CPrefTab *prefs, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
	CAllTabs(LPCTSTR pszCaption, CPrefTab *prefs, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
	virtual ~CAllTabs();

	LRESULT OnTrayNotification(WPARAM wParam, LPARAM lParam);
	CTrayNot *_trayNot;

protected:
	DECLARE_MESSAGE_MAP()
public:
	BOOL downloadAlbums(CString name, BOOL reload, BOOL connect);

	CAlbumsTab *_albumsTab;

private:
	XmlExtractor _xmlExtractor;

public:
	CHttpGet _grabXmlList;

public:
	CHttpGet _grabPicList;
private:
	CHttpGet _miscGrabber;
public:
	BOOL downloadXml(void);
	BOOL loadCache(CString name);
private:
	int _progress;
public:
	CString computeURL(CString name, int page);
	BOOL initPages(CAlbumsTab *albumsTab);
	BOOL _similar;
	int _pages;
	BOOL downloadPic(void);
	BOOL checkDownload(void);
//	afx_msg void OnPaint();
	BOOL updateProgession(int step);
	BOOL downloadSimilar(Album *album);
	BOOL finalizeLoading(void);
	int checkVersion(void);
	virtual BOOL OnInitDialog();
	int downloadBigPic(void);
	CPrefTab* _prefs;
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	afx_msg void OnDestroy();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	void OnRestore(void);
protected:
//	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
private:
	int _bigPicture;
public:
	afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
	afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
	void OnShowMainWindow(void);
	void OnShowMini(void);
private:
	CString _artistName;
};


